package com.sgmder.demo.controller;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class ServiceController {

    private static final String SHUTDOWN_SECRET = "woshizhu-shutdown-springcloud-eureka-server";

    /**
     * 关闭系统
     */
    @GetMapping ("/shutdown")
    public String ShutdownSystem(@RequestParam String secret) {
        if (SHUTDOWN_SECRET.equals(secret)) {
            System.exit(0);
            return "success";
        } else {
            return "no access";
        }
    }
}
